package com.sky.mapper;

import com.github.pagehelper.Page;
import com.sky.dto.DishDTO;
import com.sky.dto.DishPageQueryDTO;
import com.sky.entity.Dish;
import com.sky.entity.DishFlavor;
import com.sky.vo.ShoppingCartADDVO;
import io.swagger.models.auth.In;
import org.apache.ibatis.annotations.*;

import java.math.BigDecimal;
import java.util.List;

@Mapper
public interface DishMapper {
    @Select("select * from dish where category_id = #{categoryId} and status!=0")
    List<Dish> getBycate_id(Integer id);
    Page<Dish> geyBy_page(DishPageQueryDTO dto);
    @Update("update dish set status = #{status} where id = #{id}")
    void startOrstop(Integer status, Long id);
    @Select("select * from dish where id = #{id}")
    Dish getdish(Long id);
    @Insert("insert into dish (id,name,price,image,status,description,category_id,create_time,update_time,create_user,update_user) values (#{id},#{name},#{price},#{image},#{status},#{description},#{categoryId},#{createTime},#{updateTime},#{createUser},#{updateUser})")
    void insert(Dish dto);
    @Select("select id from dish where name = #{name}")
    Long getidbyname(String name);
    void update(Dish dish);
    void delete_dishes(String [] id);
    @Delete("delete from dish where category_id = #{id}")
    void delete_dishesBycategoryId(Long id);
    @Select("select id from dish where category_id = #{categoryId}")
    List<Long> getdishesBycategoryId(Long categoryId);

    List<Dish> getdishesByids(String [] ids);
    @Select("select status from dish where id = #{id}")
    Integer getStatusByid(Long id);
    @Select("select image,name,price from dish where id = #{id}")
    ShoppingCartADDVO get(Long id);

    List<String> getimageByid(List<Long> ids);
}
